'use strict';
const path = require('path');
function resolve(dir) {
    return path.join(__dirname, dir);
}

//所有的配置项可参考 https://cli.vuejs.org/zh/config/
module.exports = {
    lintOnSave: true,
    devServer: {
        port: 9999,
        open: true,
        overlay: {
            warnings: false,
            errors: false,
        },
    },
    css: {
        // antdv 引入， less-loader 版本不能太高，会报错
        loaderOptions: {
            less: {
                lessOptions: {
                    javascriptEnabled: true,
                },
            },
        },
    },
    chainWebpack(config) {
        // set svg-sprite-loader
        config.module
            .rule('icons')
            .test(/\.svg$/)
            .include.add(resolve('src/assets/icons'))
            .add(resolve('../insight-stage/package/assets/icons'))
            .end()
            .use('svg-sprite-loader')
            .loader('svg-sprite-loader')
            .options({
                symbolId: 'icon-[name]',
            })
            .end();
        config.module
            .rule('vue')
            .use('vue-loader')
            .loader('vue-loader')
            .tap((options) => {
                options.compilerOptions.preserveWhitespace = true;
                return options;
            })
            .end();
    },
};
